package com.ruoyi.controller;


import com.alibaba.fastjson2.JSON;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.order.domain.MgOrderNodeRecord;
import com.ruoyi.order.service.IMgOrderNodeRecordService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * 科腾订单操作节点信息记录Controller
 *
 * @author ruoyi
 * @date 2024-02-22
 */
@RestController
@RequestMapping("/kt/record")
@Slf4j
public class MgOrderNodeRecordController
{
    @Resource
    private IMgOrderNodeRecordService mgOrderNodeRecordService;

    /**
     * 获取订单时间轴信息
     * @param mgOrderNodeRecord
     * @return
     */
    @PostMapping("/orderNodeList")
    public AjaxResult orderNodeList(@RequestBody MgOrderNodeRecord mgOrderNodeRecord) {
        AjaxResult ajaxResult = new AjaxResult();
        log.info("获取订单时间轴信息,入参打印:{}", JSON.toJSONString(mgOrderNodeRecord));
        List<MgOrderNodeRecord> mgOrderNodeRecords = mgOrderNodeRecordService.selectByOrderId(mgOrderNodeRecord.getOrderId());
        log.info("获取订单时间轴信息,出参打印:{}", JSON.toJSONString(mgOrderNodeRecords));
        ajaxResult.put("resultCode", 200);
        ajaxResult.put("message", "查询成功");
        ajaxResult.put("data", mgOrderNodeRecords);
        return ajaxResult;
    }

}
